package org.friut.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Regular {

	public static boolean isNum(String value) {
		return value.matches("^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$");
	}
	
	/**
	 * Check is tel number
	 * 
	 * @param value
	 * @return
	 */
	public static boolean isTelNum(String value) {
		Pattern p = Pattern.compile("^[1]([3][0-9]{1}|59|58|88|89)[0-9]{8}$");  
		Matcher m = p.matcher(value);  
		return m.find();
	}
	
	/**
	 * Check is QQ number
	 * 
	 * @param value
	 * @return
	 */
	public static boolean isQqNum(String value) {
		Pattern p = Pattern.compile("[1-9][0-9]{5,13}");  
		Matcher m = p.matcher(value);  
		return m.find();
	}
}
